package com.example.qxfw.dataBaseManager.nyzjk.controller;

import com.example.qxfw.common.SysResult;
import com.example.qxfw.common.entity.ny.CropGrowdateIndexlib;
import com.example.qxfw.dataBaseManager.nyzjk.service.ZzsyqkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/************************************
 *
 * @author : HuangDeYin Jolly
 * @since : JDK 11
 * @Date : 2023/7/6  星期四   11:37
 * @description : 此类用来 种植生育期库
 ***************************************/
@Slf4j
@Api(tags = "数据库管理-农业专家库-种植生育期库")
@RestController
@CrossOrigin
@RequestMapping("/ZzsyqkController")
public class ZzsyqkController {

    @Autowired
    private ZzsyqkService zzsyqkService;

    @ApiOperation("查询")
    @GetMapping("selectOrderByCropName")
    public SysResult selectOrderByCropName(){
        List<CropGrowdateIndexlib> cropGrowdateIndexlibs = this.zzsyqkService.selectOrderByCropName();
        return SysResult.success(cropGrowdateIndexlibs);
    }

    @ApiOperation("查询作物发育期指标库,自定义查询列")
    @GetMapping("selectDistinct")
    public SysResult selectDistinct(String field,String cropname){
        List<CropGrowdateIndexlib> cropGrowdateIndexlibs = this.zzsyqkService.selectDistinct(field, cropname);
        return SysResult.success(cropGrowdateIndexlibs);
    }

    @ApiOperation("模糊查询")
    @GetMapping("selectQuery")
    public SysResult selectQuery(@RequestBody CropGrowdateIndexlib cropGrowdateIndexlib){
        List<CropGrowdateIndexlib> cropGrowdateIndexlibs = this.zzsyqkService.selectQuery(cropGrowdateIndexlib);
        return SysResult.success(cropGrowdateIndexlibs);
    }

    @ApiOperation("根据indexId查询")
    @GetMapping("selectByIndexId")
    public SysResult selectByIndexId(String indexId){
        List<CropGrowdateIndexlib> cropGrowdateIndexlibs = this.zzsyqkService.selectByIndexId(indexId);
        return SysResult.success(cropGrowdateIndexlibs);
    }




}
